#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.maple import *

# variáveis úteis
half = M('1/2')
t = M.t
_i, _j, _k = M('_i, _j, _k')
rr = M('`..`')

# parâmetros iniciais
a = M(oneof(1, 2, 3))
b = a + oneof(1, 2)
a, b = oneof((a, b), (b, a))
r = oneof(1, 2, 3, 4, 5) * oneof(-1, 1)
s = oneof(1, 2, 3, 4, 5) * oneof(-1, 1)

F = r * y * _i + s * x * _j
Fx = M.coeff(F, _i)
Fy = M.coeff(F, _j)
print('a: %s, b: %s\nF: %s' % (a, b, F))

# respostas
work = a * b * (r - s) / 2
workNeg = -work
wDiagE = a * b * (3 * r + s) / 2
wDiagENeg = -wDiagE
wDiagO = -a * b * (r + s) / 2
wDiagONeg = -wDiagO
wElemL = r * a * b + (b + a) * (r * a ** 3 + s * b * a ** 2) / (2 * b ** 2)
wMod = r * a * b + M.sqrt((b ** 2 + a ** 2) * (r ** 2 * a ** 2 + s ** 2 * b ** 2)) * a ** 2 / (2 * b ** 2)

print('work: %s' % work)
print('wDiagE: %s' % wDiagE)
print('wDiagO: %s' % wDiagO)
print('wElemL: %s' % wElemL)
print('wMod: %s' % wMod)
